package com.jy.task.event;

import javax.annotation.PostConstruct;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.jy.service.filemanager.taskmain.TaskMainService;
import com.jy.service.task.base.ScheduleJobService;

/**
 * 定时任务初始化
 */
@Component
public class ScheduleJobInit {

	/** 日志对象 */
	private static final Logger LOG = LoggerFactory
			.getLogger(ScheduleJobInit.class);

	/** 定时任务service */
	@Autowired
	private ScheduleJobService scheduleJobService;
	@Autowired
	private TaskMainService taskMainService;

	/**
	 * 项目启动时初始化
	 */
	@PostConstruct
	public void init() {
		LOG.info("定时任务初始化init");
		// scheduleJobService.initScheduleJob();
		// 初始化定时任务
		taskMainService.initTaskJob();
		// 初始化轮询定时任务，轮询take表，若任务过期则停掉任务
		taskMainService.initCheckTaskJob();
		LOG.info("定时任务初始化end");
	}

}
